package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum GoodsType {
	
	SHOP(0,"到店"),
	DELIVERY(1,"配送"),
	MAIL(2,"直邮"),
	EAT(3,"自提"),
	RESERVE(4,"预定");
	
	private Integer status;
	
	private String value;

	private GoodsType(Integer status,String value){
		this.status = status;
		this.value = value;
	}

	public int toIntStatus() {
		return this.status;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static GoodsType toFlag(int status) {
		if (MAIL.status == status) {
			return MAIL;
		} else if (SHOP.status == status) {
			return SHOP;
		} else if (DELIVERY.status == status) {
			return DELIVERY;
		} else if (EAT.status == status) {
			return EAT;
		} else if (RESERVE.status == status) {
			return RESERVE;
		} else {
			throw new InvalidArgumentException("Unknown GoodsType[" + status + "].");
		}
	}
}
